import datetime
from applications.extensions import db


class Record(db.Model):
    __tablename__ = 'admin_record'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    hospital_no = db.Column(db.String(32), comment='所属医院')
    user_id = db.Column(db.Integer, comment='添加人id', default=0)
    device_no = db.Column(db.String(32), comment='设备编号')
    name = db.Column(db.String(32), comment='样本名称')
    username = db.Column(db.String(32), comment='姓名')
    case_no = db.Column(db.String(32), comment='病例号')
    create_time = db.Column(db.DateTime, default=datetime.datetime.now, comment='创建时间')
    cts = db.Column(db.String(500), comment='样本值')
    type = db.Column(db.Integer, default=0, comment='记录类型。1云端生成 2医院同步')
    results = db.Column(db.String(32), comment='预测结果')
    random = db.Column(db.String(32), comment='随机码')
    id_card = db.Column(db.String(32), comment='身份证号')
    test_time = db.Column(db.DateTime, default=datetime.datetime.now, comment='检测时间')
    sex = db.Column(db.Integer, default=1, comment='1男 2女')
    dow_count = db.Column(db.Integer, comment='下载数量', default=0)
    states = db.Column(db.String(10), comment='状态  空：正常 1：u6数据异常 2：mir数据异常')
    exception = db.Column(db.String(244), comment='异常理由 states不为空时有值')
